#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int* countBits(int n, int* returnSize) {
    int* ret = (int*)malloc(sizeof(int) * (n + 1));
    ret[0] = 0;
    *returnSize = n + 1;
    for (int i = 1; i <= n; i++)
    {
        ret[i] = ret[i >> 1] + (i & 1);
    }
    return ret;
}

int main()
{
    int n = 0;
    int* returnSize=NULL;
    int* m=NULL;
    scanf("%d", &n);
    m=countBits(n, returnSize);
    for (int i = 0; i <= *returnSize; i++)
        printf("%d ", m[i]);
    return 0;
}